package com.lyfx.ly.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lyfx.ly.entity.AttrAttrgroupEntity;
import com.lyfx.ly.service.AttrAttrgroupService;
import com.lyfx.common.utils.PageUtils;
import com.lyfx.common.utils.R;



/**
 * 
 *
 * @author lsy
 * @email lsy@gmail.com
 * @date 2020-07-11 17:57:41
 */
@RestController
@RequestMapping("ly/attrattrgroup")
public class AttrAttrgroupController {
    @Autowired
    private AttrAttrgroupService attrAttrgroupService;

    /**
     * 列表
     */
    @RequestMapping("/list")
   // @RequiresPermissions("ly:attrattrgroup:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = attrAttrgroupService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
   // @RequiresPermissions("ly:attrattrgroup:info")
    public R info(@PathVariable("id") Long id){
		AttrAttrgroupEntity attrAttrgroup = attrAttrgroupService.getById(id);

        return R.ok().put("attrAttrgroup", attrAttrgroup);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("ly:attrattrgroup:save")
    public R save(@RequestBody AttrAttrgroupEntity attrAttrgroup){
		attrAttrgroupService.save(attrAttrgroup);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("ly:attrattrgroup:update")
    public R update(@RequestBody AttrAttrgroupEntity attrAttrgroup){
		attrAttrgroupService.updateById(attrAttrgroup);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("ly:attrattrgroup:delete")
    public R delete(@RequestBody Long[] ids){
		attrAttrgroupService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
